class CommitDpd
  include DailyProjectDetails
  
  def initialize(document)
    @name = 'Commit'
    @document = document
    @data = Array.new
    parse_document
  end
  
  def parse_document
    #[1] Get the project that this dpd is associated with.
    REXML::XPath.each(@document, '/' + @name + "DailyProjectData") do |e|
      @project = "#{e.attributes['Project']}"
    end
    
    #[2] Get the UnitTest data associated with the project.
    REXML::XPath.each(@document, '/' + @name + "DailyProjectData/MemberData") do |e|
      data = SensorData.new
      data.add_mapping('Commits', "#{e.attributes['Commits']}")
      data.add_mapping('LinesAdded', "#{e.attributes['LinesAdded']}")
      data.add_mapping('LinesDeleted', "#{e.attributes['LinesDeleted']}")
      data.add_mapping('LinesChanged', "#{e.attributes['LinesChanged']}")
      @data.push(data)
    end
  end
end
